package cnhy.salary.domain.dto;

import cn.hutool.core.util.ReflectUtil;
import cnhy.salary.domain.Employee;
import com.easy.query.core.annotation.Column;
import com.easy.query.core.annotation.EasyWhereCondition;
import com.easy.query.core.annotation.EntityProxy;
import com.easy.query.core.annotation.Table;

import com.ruoyi.common.annotation.Excel;
import io.swagger.annotations.ApiModelProperty;
import ling.common.domain.entity.IDeptEntity;
import lombok.Data;
import lombok.experimental.Delegate;

import java.util.Arrays;
import java.util.Date;


@Data
@Table("v_employee_info")
public class EmployeeDto extends  Employee implements IDeptEntity {
//    @Delegate
//    Employee employee;

    public void nullDoubleToDefault() {
        Arrays.stream(ReflectUtil.getFields(this.getClass()))
                .filter(p -> {
                    try {
                        return p.getType() == Double.class && p.get(this) == null;
                    } catch (IllegalAccessException e) {
                        return false;
                    }
                })
                .forEach(p -> {
                    try {
                        p.set(this, 0d);
                    } catch (IllegalAccessException e) {
                    }
                });
    }

    @Excel(name = "状态", readConverterExp="0=正常,1=禁用")
    @ApiModelProperty(value = "用户状态", notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    Long userStatus;

    /**  登录账户
     *
     */
    @ApiModelProperty(value = "用户登录账户", notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    String userName;

    @ApiModelProperty(value = "所属部门id", notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    @Column(primaryKey = true, generatedKey = true)
    private Long deptId;

    /**
     * 父部门ID
     */
    @ApiModelProperty(value = "父级部门id", notes = "")
    private Long parentId;

    /**
     * 祖级列表
     */
    @ApiModelProperty(value = "部门路径", notes = "")
    private String ancestors;

    /**
     * 部门名称
     */
    @EasyWhereCondition
    private String deptName;
    @EasyWhereCondition
    private String deptPhone;

    @ApiModelProperty(value = "部门负责人名称", notes = "")
    private String leader;
    @ApiModelProperty(value = "部门负责人id", notes = "")
    private Long leaderId;
    /**
     * 部门状态:0正常,1停用
     */
    @ApiModelProperty(value = "部门状态:0正常,1停用", notes = "")
    private String deptStatus;

    //

    /**
     *
     */
    @ApiModelProperty(value = "岗位名称", notes = "")
    @EasyWhereCondition
    private String postName;


    /**
     * 所属班组id-岗位
     */
    @ApiModelProperty(value = "所属班组id-岗位", notes = "")
    private Long lv2Id;


    /**
     * 所属班组名称-岗位
     */
    @ApiModelProperty(value = "所属班组名称-岗位", notes = "")
    @EasyWhereCondition
    private String lv2Name;


    /**
     * 岗位类型:0计件、1固定、2系数
     */
    @ApiModelProperty(value = "岗位类型:0计件、1固定、2系数", notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    private Integer postType;

    /**
     * 级别：0普通，1班长，2主任
     */
    @ApiModelProperty(name = "级别：0普通，1班长，2主任", notes = "")
    @EasyWhereCondition(type = EasyWhereCondition.Condition.EQUAL)
    private Integer rank;
    /**
     * 月得分系数
     */
    @ApiModelProperty(value = "月得分系数", notes = "")
    private Double ratioWage;


    /**
     * 计件单价
     */
    @ApiModelProperty(value = "计件单价", notes = "")
    private Double pieceworkWage;


    /**
     * 日薪资
     */
    @ApiModelProperty(value = "日薪资", notes = "")
    private Double fixedWage;


    /**
     * 餐补
     */
    @ApiModelProperty(value = "餐补", notes = "")
    private Double mealAllowance;


    /**
     * 岗位津贴
     */
    @ApiModelProperty(value = "岗位津贴", notes = "")
    private Double postAllowance;


    /**
     * 应出勤天数,移动到月配置
     */
//    @ApiModelProperty(value = "应出勤天数,移动到月配置", notes = "")
//    private Double workingDays;
//
//
//    /**
//     * 满勤奖,移动到总字典配置
//     */
//    @ApiModelProperty(value = "满勤奖,移动到总字典配置", notes = "")
//    private Double workedDaysWage;
//
//
//    /**
//     * 社保费用,移动到总字典配置
//     */
//    @ApiModelProperty(value = "社保费用,移动到总字典配置", notes = "")
//    private Double insurance;

    /** 上班时间 */
    @ApiModelProperty(value = "上班时间",notes = "")
    private Date postWorkStart ;


    /** 下班时间 */
    @ApiModelProperty(value = "下班时间",notes = "")
    private Date postWorkEnd ;
    //
    @EasyWhereCondition
    @ApiModelProperty(value = "产线", notes = "")
    private Long lineId;
    /**
     *
     */
    @EasyWhereCondition
    @ApiModelProperty(value = "产线名称", notes = "")
    private String lineName;


    /**
     * 负责人名称
     */
    @EasyWhereCondition
    @ApiModelProperty(value = "产线负责人名称", notes = "")
    private String lineLeader;


    /**
     * 电话
     */
    @ApiModelProperty(value = "产线负责人电话", notes = "")
    @EasyWhereCondition
    private String linePhone;

    /** 排序 */
    @Excel(name = "排序")
    @ApiModelProperty(value = "排序",notes = "")
    private Integer orderNum;
}
